/*
 *      IL_SSA_TokenWrapper.java
 *
 *      Copyright 2008 Pablo Nicolas Diaz Bilotto <pablonicolas.diaz@gmail.com>
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */

package ilanguage.iltokens;

import lexer.EntryType;
import lexer.token.BaseToken;


/**
 * este tiene un token que fue creado por mi lexer
 * The Class IL_SSA_TokenWrapper.
 */
public class IL_SSA_TokenWrapper extends IL_SSA {

	/** The Token. */
	private BaseToken Token;

	/**
	 * Instantiates a new i l_ ss a_ token wrapper.
	 *
	 * @param Token the token
	 */
	public IL_SSA_TokenWrapper(BaseToken Token) {
		this.Token = Token;
	}

	/**
	 * Gets the internal token.
	 *
	 * @return the token
	 */
	public BaseToken getToken() {
		return Token;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see ILanguage.IL_Token#GetValue()
	 */
	public Object getValue() {
		return this.Token.getValue();
	};

	/*
	 * (non-Javadoc)
	 *
	 * @see ILanguage.IL_Token#IsDiscartable()
	 */
	public boolean isDiscartable() {
		return !Token.hasValidType();
	}

	/**
	 * Sets the internal token.
	 *
	 * @param token the new token
	 */
	public void setToken(BaseToken token) {
		Token = token;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see ILanguage.IL_Token#SolveTypes()
	 */
	public EntryType solveTypes() {
		return this.Token.getType();
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see ILanguage.IL_Token#toString()
	 */
	public String toString() {
		return "DISCARTABLE_TOKEN_HOLDER";
	}
	@Override
	public String getResultRegister() {
		return this.getValue().toString();
	}

}
